'''
Created on Jun 6, 2012

@author: thomas_dao
'''
from google.appengine.ext import ndb
from entity.entity import CheckIn



@ndb.tasklet
def get_by_location(location_key, **q_options):
    qry = CheckIn.query(CheckIn.location == location_key).order(-CheckIn.created_time)
    data = yield qry.fetch_async(20, **q_options)
    raise ndb.Return(data)   
         
@ndb.tasklet
def get_by_author(author_key, **q_options):
    qry = CheckIn.query(CheckIn.author == author_key).order(-CheckIn.created_time)
    data = yield qry.fetch_async(20, **q_options)
    raise ndb.Return(data)